<html>
<head><meta charset="utf-8"><title>RFC follow-up · project-ffi-unwind · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/index.html">project-ffi-unwind</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html">RFC follow-up</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="201348539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201348539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201348539">(Jun 19 2020 at 03:18)</a>:</h4>
<p>How do we want to address petrochenkov's point that there must be some safe way to unwind through <code>system</code> and <code>thiscall</code> ABIs in order to remove <code>#[unwind(allowed)] </code> from the standard library?</p>
<p>Additionally, do we want to re-open discussion of whether unwinding should be the default rather than an opt-in behavior?</p>



<a name="201348558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201348558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201348558">(Jun 19 2020 at 03:19)</a>:</h4>
<p>I.e. the unwinding ABI would be <code>extern "C"</code>, and we'd introduce a new C-without-unwinding ABI</p>



<a name="201366223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201366223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201366223">(Jun 19 2020 at 08:57)</a>:</h4>
<p>I'd say that the "ABI" part and "unwind" part should ideally be orthogonal, but right now introducing <code>extern "(system,thiscall) unwind"</code> for the standard library use and not stabilizing them should be ok.</p>



<a name="201366364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201366364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201366364">(Jun 19 2020 at 08:58)</a>:</h4>
<p>If the unwind part becomes orthogonal in the future, like <code>extern "C" unwind fn foo()</code>, then we can always keep <code>"C unwind"</code> for compatibility and desugar it into <code>"C" unwind</code>.</p>



<a name="201393063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201393063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201393063">(Jun 19 2020 at 13:56)</a>:</h4>
<p>that's a really good point</p>



<a name="201393151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201393151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201393151">(Jun 19 2020 at 13:56)</a>:</h4>
<p>I'm surprised we didn't talk about it already!</p>



<a name="201393204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201393204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201393204">(Jun 19 2020 at 13:57)</a>:</h4>
<p>It does feel to me like the "right thing" is for the unwind to be kind of orthogonal, but perhaps that just means having "unwind" variants of system/thiscall/C</p>



<a name="201393213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201393213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201393213">(Jun 19 2020 at 13:57)</a>:</h4>
<p>at least for now</p>



<a name="201393214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201393214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201393214">(Jun 19 2020 at 13:57)</a>:</h4>
<p>We did...that's how RFC 2699 worked, at least at one point</p>



<a name="201393258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201393258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201393258">(Jun 19 2020 at 13:57)</a>:</h4>
<p>ok well I wasn't involved :)</p>



<a name="201393291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201393291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201393291">(Jun 19 2020 at 13:57)</a>:</h4>
<p>I just mean that in these recent conversations we haven't talked about non-C APIs that unwind</p>



<a name="201393355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201393355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201393355">(Jun 19 2020 at 13:58)</a>:</h4>
<p>anyway I think i'm fine with just saying that we have <code>extern "system unwind"</code></p>



<a name="201405955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201405955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201405955">(Jun 19 2020 at 15:33)</a>:</h4>
<p>I'm hesitant. Shouldn't <code>system</code> mean "automatically pick the right ABI for this system"? That's why we have it in addition to <code>stdcall</code>, even though <code>stdcall</code> and <code>C</code> could in theory replace <code>system</code> (using annotations to select the right one for different targets).</p>



<a name="201405974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201405974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201405974">(Jun 19 2020 at 15:33)</a>:</h4>
<p>If that's the case, then perhaps <code>system</code> should _always_ be "unwind-safe".</p>



<a name="201406007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201406007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201406007">(Jun 19 2020 at 15:34)</a>:</h4>
<p>.....on platforms that are known to support unwinding.</p>



<a name="201406119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201406119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201406119">(Jun 19 2020 at 15:35)</a>:</h4>
<p>We did briefly discuss whether we needed <code>unwind</code> for other ABIs during the lang team meeting on 2 March: langteam-sync/design-meeting-2020-03-02.md</p>



<a name="201406295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201406295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201406295">(Jun 19 2020 at 15:36)</a>:</h4>
<p>The need for <code>system</code> to unwind makes me want to reconsider the <code>"C"</code>/<code>"C nounwind"</code> option.</p>



<a name="201643738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201643738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201643738">(Jun 22 2020 at 18:33)</a>:</h4>
<p>honestly I forget where/when we use <code>system</code></p>



<a name="201643841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201643841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201643841">(Jun 22 2020 at 18:34)</a>:</h4>
<p>it seems likely to be fairly niche</p>



<a name="201643852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201643852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201643852">(Jun 22 2020 at 18:34)</a>:</h4>
<p>but maybe not :)</p>



<a name="201643957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201643957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201643957">(Jun 22 2020 at 18:35)</a>:</h4>
<p>petrochenkov's example is <code>panic</code>'s implementation on Windows: <a href="https://github.com/rust-lang/rust/blob/master/src/libpanic_unwind/seh.rs#L310">https://github.com/rust-lang/rust/blob/master/src/libpanic_unwind/seh.rs#L310</a></p>
<div class="codehilite"><pre><span></span><code><span class="w">    </span><span class="k">extern</span><span class="w"> </span><span class="s">&quot;system&quot;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="cp">#[unwind(allowed)]</span><span class="w"></span>
<span class="w">        </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">_CxxThrowException</span><span class="p">(</span><span class="n">pExceptionObject</span>: <span class="o">*</span><span class="k">mut</span><span class="w"> </span><span class="n">c_void</span><span class="p">,</span><span class="w"> </span><span class="n">pThrowInfo</span>: <span class="o">*</span><span class="k">mut</span><span class="w"> </span><span class="kt">u8</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="o">!</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="201644050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201644050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201644050">(Jun 22 2020 at 18:36)</a>:</h4>
<p>right, are there other places we use it? is it primarily just the stdlib?</p>



<a name="201644066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201644066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201644066">(Jun 22 2020 at 18:36)</a>:</h4>
<p>or is it something used "out there" in the ecosystem?</p>



<a name="201644335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201644335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201644335">(Jun 22 2020 at 18:38)</a>:</h4>
<p>Hm... I don't know. But to me, the following make me lean toward "<code>system</code> should always unwind":</p>
<ul>
<li>the name - <code>system</code> implies "automatically conform to the system's ABI". Unwinding is part of that.</li>
<li>the usage in <code>libunwind</code> - introducing an unwind-safe ABI (or multiple ABIs) should permit us to _remove_ <code>#[unwind(allowed)]</code> from the compiler rather than leaving it on nightly.</li>
</ul>



<a name="201644760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201644760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201644760">(Jun 22 2020 at 18:42)</a>:</h4>
<p>It looks like it's used in quite a few places, but I don't know if all 11k of these are "real" or not. But from looking through a half dozen pages of results, I don't see any red flags that my search isn't valid. <a href="https://github.com/search?q=%22extern+system%22+language%3ARust&amp;type=Code">https://github.com/search?q=%22extern+system%22+language%3ARust&amp;type=Code</a></p>



<a name="201645597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201645597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201645597">(Jun 22 2020 at 18:49)</a>:</h4>
<p>Resetting the discussion to the point of "whether C-like ABIs should be considered unwind by default" certainly wasn't my goal.</p>



<a name="201645795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201645795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201645795">(Jun 22 2020 at 18:50)</a>:</h4>
<p>I wish I never brought this point, and I'd want recommend against overthinking and rationalizing some new semantics to <code>extern "system"</code>.</p>



<a name="201645975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201645975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201645975">(Jun 22 2020 at 18:52)</a>:</h4>
<p>Whatever idea was originally behind "system", it's not currently used like that.<br>
De-facto it's a redundant alias to "stdcall" now and it would be better if it didn't exist, IMO.</p>



<a name="201646136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201646136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201646136">(Jun 22 2020 at 18:53)</a>:</h4>
<p>"stdcall unwind" and "thiscall unwind" can be internal implementation details and I think the RFC can proceed in the same form as it's written now.</p>



<a name="201647867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201647867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201647867">(Jun 22 2020 at 19:08)</a>:</h4>
<blockquote>
<p>We did...that's how RFC 2699 worked, at least at one point</p>
</blockquote>
<p>Although, if the wg is ready to reconsider this (<code>extern "C" unwind fn foo</code>, making ABI orthogonal to the ABI flag), then it would probably be better long term.</p>



<a name="201648280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201648280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201648280">(Jun 22 2020 at 19:12)</a>:</h4>
<p>If I recall correctly, the main reason we didn't want to do that is because we want to leave open the possibility of a separate "nopanic" feature (unrelated to <code>extern</code>) somewhere down the line.</p>



<a name="201648326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201648326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201648326">(Jun 22 2020 at 19:12)</a>:</h4>
<p>And we didn't want to "accidentally" introduce an equivalent feature.</p>



<a name="201648450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201648450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201648450">(Jun 22 2020 at 19:14)</a>:</h4>
<p>I understand not wanting <code>"system"</code> to unwind by default if <code>"C"</code> doesn't, but the fact that we'll need unwinding for <code>"stdcall"</code> and <code>"thiscall"</code> makes me think that we should reconsider the default for <code>"C"</code> as well.</p>



<a name="201648817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201648817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201648817">(Jun 22 2020 at 19:17)</a>:</h4>
<p>Unfortunately, the person who was most resistant to unwind-by-default was Centril, who is not currently active in the project or easily contactable. So if we re-opened the discussion, I suspect we could come to a different conclusion than we did before, but only because we would (presumably) no longer have an active advocate for the opposing perspective.</p>



<a name="201648964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201648964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201648964">(Jun 22 2020 at 19:19)</a>:</h4>
<p>I personally have a mild preference for no-unwind-by-default, though not a strong preference.</p>



<a name="201648980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201648980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201648980">(Jun 22 2020 at 19:19)</a>:</h4>
<p>That's helpful, I think.</p>



<a name="201648993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201648993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201648993">(Jun 22 2020 at 19:19)</a>:</h4>
<p>Specifically because <em>most</em> code doesn't need unwind, and it has a slight performance hit, and it's easy enough to add <code>unwind</code> to the <code>extern</code>.</p>



<a name="201649026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201649026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201649026">(Jun 22 2020 at 19:20)</a>:</h4>
<p>That holds doubly true if we can, without a substantial performance hit, catch unwind <em>attempts</em> and panic, at least in debug mode.</p>



<a name="201649088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201649088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201649088">(Jun 22 2020 at 19:20)</a>:</h4>
<p>(I doubt it'll be zero-overhead, but we could do it in debug.)</p>



<a name="201649138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201649138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201649138">(Jun 22 2020 at 19:21)</a>:</h4>
<p>I believe that was Centril's primary objection as well, especially w/ <code>panic=abort</code></p>



<a name="201649331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201649331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201649331">(Jun 22 2020 at 19:22)</a>:</h4>
<p>Note that w/ <code>"C unwind"</code> in the current proposal, there is no UB. I like the idea that Rust is generally "safe by default". Having possible UB for the sake of performance seems very much like the sort of thing Rust typically only permits via opt-in, not opt-out.</p>



<a name="201652846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201652846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201652846">(Jun 22 2020 at 19:55)</a>:</h4>
<p>So, we discussed this some in the meeting. I feel like the obvious fix to this problem is that we introduce additional ABIs ("stdcall unwind", etc), and I think that's...fine. I mean if we're adding "C" and "C unwind" I think honestly I would <strong>expect</strong> that you would have "unwind" variants of the various other ABIs available (and if there <em>isn't</em> a variant, I would expect that means something like unwinding doesn't work there for some other reason). This seems OK and I'm not inclined to try to change the consensus at this point.</p>



<a name="201652968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201652968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201652968">(Jun 22 2020 at 19:56)</a>:</h4>
<p>Okay. <span class="user-mention" data-user-id="237472">@acfoltzer</span> , <span class="user-mention" data-user-id="143274">@Amanieu</span> , thoughts?</p>



<a name="201655912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201655912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> acfoltzer <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201655912">(Jun 22 2020 at 20:22)</a>:</h4>
<p>I haven't been following this closely (<del>gonna read backscroll now</del> done) but this shouldn't hurt our use case, so I'm fine with it (edit: yep, this sounds fine)</p>



<a name="201658771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201658771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201658771">(Jun 22 2020 at 20:46)</a>:</h4>
<p>Okay, so my TODOs for amending the RFC are:</p>
<ul>
<li>add <code>stdcall unwind</code> and <code>thiscall unwind</code> (noting that these are not available on all platforms)</li>
<li>add <code>system unwind</code></li>
<li>Add some information to the "alternatives" section discussing letting <code>"C"</code> unwind by default (this should be in the RFC already, but I think I may have forgotten to add it, so I'll review)</li>
</ul>



<a name="201675285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201675285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Peter Rabbit <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201675285">(Jun 22 2020 at 23:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/210922-project-ffi-unwind/topic/RFC.20follow-up/near/201643841">said</a>:</p>
<blockquote>
<p>it seems likely to be fairly niche</p>
</blockquote>
<p><code>winapi</code> uses <code>system</code> for almost all its extern functions, but I'm used to <code>winapi</code> being treated like a niche thing. <span aria-label="exhausted" class="emoji emoji-1f625" role="img" title="exhausted">:exhausted:</span></p>



<a name="201705511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201705511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201705511">(Jun 23 2020 at 09:37)</a>:</h4>
<p><span class="user-mention" data-user-id="125267">@Peter Rabbit</span> I stand corrected!</p>



<a name="201705645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201705645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201705645">(Jun 23 2020 at 09:39)</a>:</h4>
<p>Though I can't tell if that implies that you have an opinion about using "system unwind" to declare intentional unwinding</p>



<a name="201716260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201716260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Peter Rabbit <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201716260">(Jun 23 2020 at 12:05)</a>:</h4>
<p>At least on Windows the cost of unwind tables is unavoidable, so the only real performance optimization is whether we emit drop tables in cases where we don't call anything that can unwind <em>other than</em> C++ so that if a C++ exception unwinds through us we can run our drops. Therefore I lean towards <em>supporting</em> unwinding by default.</p>
<p>For some prior art, cl.exe (VC++ compiler) has a flag to determine the exception handling model. <a href="https://docs.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model">https://docs.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model</a><br>
<code>/EHsc</code> will assume that <code>extern "C"</code> cannot throw exceptions while <code>/EHs</code> will assume that they <em>can</em> throw. There is no opt in for specific functions. However you can opt out by declaring specific functions as <code>noexcept</code>.</p>



<a name="201730032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201730032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201730032">(Jun 23 2020 at 14:06)</a>:</h4>
<p><span class="user-mention" data-user-id="125267">@Peter Rabbit</span> So you are arguing for making <code>extern "C"</code> unwind-by-default on Windows specifically.</p>



<a name="201730422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201730422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201730422">(Jun 23 2020 at 14:09)</a>:</h4>
<p>Because it's less of a pessimization than it is on some other plaforms not requiring unwind tables.</p>



<a name="201730755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201730755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201730755">(Jun 23 2020 at 14:11)</a>:</h4>
<p>"Support unwind-by-default on Windows" should apply to <code>extern "system"</code> <em>less</em> than to <code>extern "C"</code> in general, because winapi doesn't usually throw anything we want to run drops on, AFAIR.</p>



<a name="201730908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201730908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201730908">(Jun 23 2020 at 14:12)</a>:</h4>
<p>And winapi is pretty much the only thing that uses stdcall, even if it's large, so it <em>is</em> niche <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="201731145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201731145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201731145">(Jun 23 2020 at 14:14)</a>:</h4>
<blockquote>
<p>whether we emit drop tables in cases where we don't call anything that can unwind other than C++ </p>
</blockquote>
<p>Which is a significant optimization.<br>
Imagine any math stuff from C libraries that doesn't throw and is used in computationally heavy code.</p>



<a name="201731395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201731395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201731395">(Jun 23 2020 at 14:16)</a>:</h4>
<p><code>/EHsc</code> ftw</p>



<a name="201732661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201732661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201732661">(Jun 23 2020 at 14:25)</a>:</h4>
<p>That's the default for projects created with Visual Studio at least.</p>



<a name="201749463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201749463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201749463">(Jun 23 2020 at 16:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123856">Vadim Petrochenkov</span> <a href="#narrow/stream/210922-project-ffi-unwind/topic/RFC.20follow-up/near/201730755">said</a>:</p>
<blockquote>
<p>"Support unwind-by-default on Windows" should apply to <code>extern "system"</code> <em>less</em> than to <code>extern "C"</code> in general, because winapi doesn't usually throw anything we want to run drops on, AFAIR.</p>
</blockquote>
<p>I don't understand what you mean by this; do you just mean that winapi doesn't usually throw at all, or that something about the winapi interface makes it less likely for <code>Drop</code> objects to be used in the <em>calling</em> code, or something else?</p>



<a name="201755889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201755889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201755889">(Jun 23 2020 at 17:23)</a>:</h4>
<p>The former, winapi doesn't throw (C++-style exceptions).</p>



<a name="201757107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201757107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201757107">(Jun 23 2020 at 17:33)</a>:</h4>
<p>Ah, okay.</p>



<a name="201858037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201858037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201858037">(Jun 24 2020 at 14:55)</a>:</h4>
<p>When you say winapi doesn't through, are you saying that all failures are communicated through return codes, and not using SEH ?</p>



<a name="201858118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201858118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201858118">(Jun 24 2020 at 14:55)</a>:</h4>
<p>I feel like having the behavior of whether unwinding is UB or not depend on the platform (windows one way, other platforms another) is surprising and bound to cause portability hazards. I would not want to go that path.</p>



<a name="201858280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201858280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201858280">(Jun 24 2020 at 14:56)</a>:</h4>
<p>But I am interested to know whether winapi would expect to modify all of its ABIs from <code>extern "system"</code> to <code>extern "system unwind"</code> -- this was something we talked about with respect to libc and functions like <code>read</code> (which in some niche cases may use unwinding, but only with forced unwinds).</p>



<a name="201858368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201858368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201858368">(Jun 24 2020 at 14:57)</a>:</h4>
<p>That's explicitly called out in the RFC as the reason we consider forced unwinding over non-POFs to be UB.</p>



<a name="201858538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201858538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201858538">(Jun 24 2020 at 14:58)</a>:</h4>
<p>("that" meaning your point about the portability hazard of having UB on some platforms but not others for the same code)</p>



<a name="201926815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201926815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Peter Rabbit <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201926815">(Jun 25 2020 at 02:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/210922-project-ffi-unwind/topic/RFC.20follow-up/near/201858037">said</a>:</p>
<blockquote>
<p>When you say winapi doesn't through, are you saying that all failures are communicated through return codes, and not using SEH ?</p>
</blockquote>
<p>All Windows API failures are communicated through return codes, so <code>winapi</code> would <em>not</em> opt into unwinding. When an SEH exception occurs 99% of the time you just want to crash the process because it indicates a fatal error. 1% of the time it is because you are doing things like reading/writing memory mapped files and the disk backing the file was unmounted and suddenly your read/write causes an SEH exception, in which case you use <code>__try</code> and <code>__catch</code> to catch that exception and gracefully return an error. I'd really love to have the equivalent of <code>__try</code> and <code>__catch</code> in Rust.</p>
<p>The fun thing about SEH exceptions is that they can occur at <em>any</em> instruction, not just function calls or explicit throws. In C++ by default SEH exceptions do <em>not</em> trigger destructors and are <em>not</em> caught by <code>catch(...)</code> (although you can specify <code>/EHa</code> if you really want that).</p>



<a name="201926978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201926978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201926978">(Jun 25 2020 at 02:39)</a>:</h4>
<p>I take it that's what the LLVM docs mean when they refer to SEH as a form of "async exception"?</p>



<a name="201928416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201928416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201928416">(Jun 25 2020 at 03:14)</a>:</h4>
<p>FYI as currently implemented we only run destructors for C++ exceptions (which panics are based on) and (sometimes) longjmp exception.</p>



<a name="201928424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/201928424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#201928424">(Jun 25 2020 at 03:14)</a>:</h4>
<p>I would therefore consider any SEH exception as outside the scope of the RFC.</p>



<a name="202368981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/202368981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#202368981">(Jun 29 2020 at 21:14)</a>:</h4>
<p>So -- from what I understand -- we are basically set to move forward, with the plan being to add unwind variants of ABIs as we find we need them, correct?</p>



<a name="202369023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/202369023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#202369023">(Jun 29 2020 at 21:15)</a>:</h4>
<p><span class="user-mention" data-user-id="120076">@BatmanAoD (Kyle Strand)</span> did you have any further edits to make or shall I fcp merge?</p>



<a name="202369094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/202369094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#202369094">(Jun 29 2020 at 21:15)</a>:</h4>
<p>I want to add the ABIs we already know we need before fcp.</p>



<a name="202369147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/202369147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#202369147">(Jun 29 2020 at 21:16)</a>:</h4>
<p>I have a few "TODO"s in comments in the document.</p>



<a name="202369160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/202369160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#202369160">(Jun 29 2020 at 21:16)</a>:</h4>
<p>But adding the other strings is the main one.</p>



<a name="202442607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/202442607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#202442607">(Jun 30 2020 at 14:26)</a>:</h4>
<p>OK. I think it's important to state that we expect to be adding more but not critical that it should be "complete". I think we should probably just list some and state that the set may vary.</p>



<a name="202507852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/202507852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#202507852">(Jun 30 2020 at 23:31)</a>:</h4>
<p>Do you think it would be acceptable to add new <code>unwind</code> ABIs after the RFC has landed without opening a new RFC? That seems like it would be a pretty minor change</p>



<a name="202573586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/202573586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#202573586">(Jul 01 2020 at 14:14)</a>:</h4>
<p>I fully expect to do so</p>



<a name="202573637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/202573637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#202573637">(Jul 01 2020 at 14:15)</a>:</h4>
<p>I think we can say that explicitly, but the point of the RFC (in my view) is to establish the precedent, not to enumerate each use of it</p>



<a name="202854935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/202854935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#202854935">(Jul 04 2020 at 04:04)</a>:</h4>
<p>I've pushed a few changes</p>



<a name="203002892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/203002892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#203002892">(Jul 06 2020 at 15:20)</a>:</h4>
<p><span class="user-group-mention" data-user-group-id="1866">@WG-ffi-unwind</span> I completed my "to do" items over the weekend. From my perspective, the RFC is ready for FCP.</p>



<a name="203210625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/210922-project-ffi-unwind/topic/RFC%20follow-up/near/203210625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/210922-project-ffi-unwind/topic/RFC.20follow-up.html#203210625">(Jul 07 2020 at 22:21)</a>:</h4>
<p><span class="user-group-mention" data-user-group-id="1866">@WG-ffi-unwind</span> I've made a few more changes, hopefully resolving <span class="user-mention" data-user-id="120791">@RalfJ</span> 's concerns.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>